package edu.suda.scratcher.ippgserver.mapper;

import edu.suda.scratcher.ippgserver.beans.Record;
import org.apache.ibatis.annotations.*;

public interface RecordMapper {
    @Select("select * from records where rid=#{rid}")
    public Record getRecord(int rid);
    
    @Select("select * from records where username=#{username}")
    public Record[] listRecords(String username);

    @Select("select * from records where username=#{username} order by rtime desc limit 1")
    public Record getLatestRecord(String usernaString);
    
    @Insert("insert into records (username, hr, spo, rtime) values (#{username}, #{hr}, #{spo}, #{rtime})")
    public int addRecord(Record record);
}
